<?php

$images_url = base_url('images');
$main_url = base_url('main');
$usaha_url = base_url('usaha');

$mapdir = "
	<a href='$main_url'>Home</a>
	&gt; 
	<a href='$main_url/usaha.html'>Usaha</a> &gt;
";

$idc = $this->uri->segment(2,0);
$awal = $this->input->get('awal');
$dataproduk = "";

$namausaha = $this->mainmodel->get_single_data('nama','dn_company','idperusahaan', $idc);
$title = url_title($namausaha, '-', TRUE);
$mapdir .= " <a href='$usaha_url/$idc/$title/company.html'>$namausaha</a> &gt; <b>Produk</b>";
$judul = "<h5>Produk dari <b style='color:#b70bac'>".$namausaha."</b></h5>";

$produk = $this->mainmodel->get_produk_usaha($awal, $idc);

try{
	$hit = $awal+1;
}catch (Exception $e){
	$hit = 1;
}

if($produk !== FALSE)
{
	foreach($produk AS $pdata)
	{
		$title = url_title($pdata->nama, '-', TRUE);
		
		if($hit % 2 == 0)
		{
			$warna = "bgputih";
		}
		else
		{
			$warna = "bgbiru";
		}
		
		$dataproduk .= "
		<tr class='$warna'>
			<td class='left'>$hit. <a href='$main_url/detail/$pdata->idproduk/produk/$title.html'>$pdata->nama</a></td>
			<td class='right'><a href='$main_url/detail/$pdata->idproduk/produk/$title.html'>Detail</a> </td>
		</tr>";
		$hit++;
	}
}
else
{
	$dataproduk .= "
	<tr>
		<td class='left'>&nbsp;</td><td class='right'>Data Belum Tersedia</td>
	</tr>";
}

$config['base_url'] = base_url('usaha/'.$idc.'/'.$title.'/produk.html?list=all');
$config['total_rows'] = $this->mainmodel->get_hitung_produk_usaha($idc);
$config['per_page'] = 20; 
$config['first_url'] = base_url('usaha/'.$idc.'/'.$title.'/produk.html'); 
$config['page_query_string'] = TRUE; 
$config['query_string_segment'] = 'awal';

$this->pagination->initialize($config); 		
$halaman = $this->pagination->create_links();

$isipage = "
	<div id='content2'>
			<h3>Daftar Produk</h3>
				
				
				<div class='isicontent2'>
				  <p>
					 Urutan berdasarkan : <a href='$main_url/produk.html?order=desc'>Terbaru</a> | <a href='$main_url/produk.html?order=asc'>Terlama</a> | <a href='$main_url/produk.html?order=abja'>Abjad A-Z</a> | <a href='$main_url/produk.html?order=abjz'>Abjad Z-A</a> 
				  </p>
				</div>
				<div class='isicontent2'>
				  
					 
					 <form method='get' action='$main_url/search/produk.html'>
						Cari Produk : 
						<input type='text' name='cari' placeholder='masukan kata kunci' />
						<input type='submit' value='cari produk' />
					 </form>
				  
				</div>
				
				<div class='isicontent2'>
					<div id='produk'>
					$judul
					<table>
						<tbody>
							
							$dataproduk
								
							<tr>
								<td class='left'>&nbsp;</td>
								<td class='right'>$halaman</td>
							</tr>
						</tbody>
					</table>
					</div>
				</div>
				
			</div>
";

$data['map_dir'] = $mapdir;
$data['isi_page'] = $isipage;
$data['site_title'] = 'Daftar Produk - Dadan Network';
$data['site_description'] = 'Dadan Network adalah situs berbagi informasi tentang jaringan profesional antar enterpreneur indonesia';
$data['site_keywords'] = 'dadan, network, profesional, enterpreneur, produk, usaha';
$data['base_url'] = base_url();
$data['tahun_sekarang'] = date("Y");
$data['other_head'] = '';

$this->parser->parse('template/home', $data);

/* End of file produk.php */
/* Location: ./application/views/company/produk.php */
